package logic

import (
	"context"

	"mygozero/usercenter/internal/svc"
	"mygozero/usercenter/pb"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetUserInfoLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
	return &GetUserInfoLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetUserInfoLogic) GetUserInfo(in *pb.GetUserInfoReq) (*pb.GetUserInfoResp, error) {
	// todo: add your logic here and delete this line
	user := pb.User{}
	if in.GetId() == 1 {
		user.Nickname = "张三"
		user.Sex = 0
	} else {
		user.Nickname = "李四"
		user.Sex = 1
	}
	user.Id = in.Id
	return &pb.GetUserInfoResp{User: &user}, nil
}
